(momentary-string-display): After moving point, set POS variable to it to avoid
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 2 Jan 2007 23:44:44 +0000 (23:44 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 2 Jan 2007 23:44:44 +0000 (23:44 +0000)
later errors once the buffer is modified.  Doc fix.

lisp/subr.el

index 086163cca72969c48f5249f2ceaf7eb264a3953a..c98e14b6334b01abd7cd95479a70faf4a258cfaa 100644 (file)
@@ -1887,6 +1887,7 @@ menu bar menus and the frame title."
 (defun momentary-string-display (string pos &optional exit-char message)
   "Momentarily display STRING in the buffer at POS.
 Display remains until next event is input.
+If POS is a marker, only its position is used; its buffer is ignored.
 Optional third arg EXIT-CHAR can be a character, event or event
 description list.  EXIT-CHAR defaults to SPC.  If the input is
 EXIT-CHAR it is swallowed; otherwise it is then available as
@@ -1904,6 +1905,8 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
        (progn
          (save-excursion
            (goto-char pos)
+           ;; To avoid trouble with out-of-bounds position
+           (setq pos (point))
            ;; defeat file locking... don't try this at home, kids!
            (setq buffer-file-name nil)
            (insert-before-markers string)